﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace HeliGame
{
    class Floor
    {
        public Texture texture;

        public Floor(Texture texture)
        {
            this.texture = texture;
        }

        public void Draw(Effect effect, GraphicsDevice device)
        {
            int size = 40;
            float xTexScale = 40;
            float yTexScale = 40;
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                device.DrawUserPrimitives<WallVertex>(PrimitiveType.TriangleList, new WallVertex[]
                    {
                        new WallVertex(new Vector3(-size, 0, size), new Vector3(0, 1, 0), Color.White, new Vector2(0, 0)),
                        new WallVertex(new Vector3(-size, 0, -size), new Vector3(0, 1, 0), Color.White, new Vector2(1*xTexScale, 0)),
                        new WallVertex(new Vector3(size, 0, size), new Vector3(0, 1, 0), Color.White, new Vector2(0, 1*yTexScale)),

                        new WallVertex(new Vector3(size, 0, size), new Vector3(0, 1, 0), Color.White, new Vector2(0, 1*yTexScale)),
                        new WallVertex(new Vector3(-size, 0, -size), new Vector3(0, 1, 0), Color.White, new Vector2(1*xTexScale, 0)),
                        new WallVertex(new Vector3(size, 0, -size), new Vector3(0, 1, 0), Color.White, new Vector2(1*xTexScale, 1*yTexScale))
                    },
                    0, 2, WallVertex.VD);
            }
        }
    }
}
